package homework.mapper;

import homework.bean.Teacher;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface TeacherMapper {
    //查全部
     @Select("select * from teacher")
     @Results({
             @Result(column = "id",property = "id"),
             @Result(column = "name",property = "name"),
             @Result(
                     property = "student",
                     javaType = List.class,
                     column = "id",
                     many=@Many(select = "homework.mapper.StudentMapper.selectById")
             )
     })
     List<Teacher> selectAll();
}
